home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBGRX100.ARJ / MOUSETST.C < prev    next >
Text File  |  1992-04-10  |  2KB  |  66 lines

  1. /** 
  2.  ** MOUSETST.C 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24.  
  25. #include "test.h"
  26. #include "mousex.h"
  27.  
  28. TESTFUNC(mousetest)
  29. {
  30.     MouseEvent evt;
  31.     int bgc = GrAllocColor(0,0,128);
  32.     int fgc = GrAllocColor(255,255,0);
  33.     int ii,mode;
  34.  
  35.     if(MouseDetect()) {
  36.         MouseEventMode(1);
  37.         MouseInit();
  38.         MouseSetColors(GrAllocColor(255,0,0),GrBlack());
  39.         MouseDisplayCursor();
  40.         GrClearScreen(bgc);
  41.         ii = 0;
  42.         mode = M_CUR_NORMAL;
  43.         for( ; ; ) {
  44.         drawing(ii,ii,GrSizeX()-20,GrSizeY()-20,fgc | GrXOR,GrNOCOLOR);
  45.         MouseGetEvent((M_KEYPRESS | M_POLL),&evt);
  46.         if(evt.flags & M_KEYPRESS) {
  47.             if(mode == M_CUR_BOX) break;
  48.             switch(++mode) {
  49.               case M_CUR_RUBBER:
  50.             MouseSetCursorMode(M_CUR_RUBBER,100,100,GrWhite() ^ bgc);
  51.             break;
  52.               case M_CUR_LINE:
  53.             MouseSetCursorMode(M_CUR_LINE,20,20,GrWhite() ^ bgc);
  54.             break;
  55.               case M_CUR_BOX:
  56.             MouseSetCursorMode(M_CUR_BOX,-20,-10,20,10,GrWhite() ^ bgc);
  57.             break;
  58.             }
  59.         }
  60.         if((ii += 7) > 20) ii -= 20;
  61.         }
  62.         MouseUnInit();
  63.     }
  64. }
  65.  
  66.